using System.Threading.Tasks;
using UnityEngine.Networking;

namespace MyFramework.Network
{
    public static class RequestExtensions
    {
        public static Task Await(this UnityWebRequestAsyncOperation operation)
        {
            TaskCompletionSource<bool> tcs = new();
            operation.completed += _ => tcs.SetResult(true);
            return tcs.Task;
        }
    }
}